{% set pypi_name = 'castellan' %}
{% set upstream_version = upstream_version('3.7.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Generic Key Manager interface for OpenStack
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/castellan
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('python-barbicanclient') }}
BuildRequires:  {{ py3('cryptography') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('reno') }}
BuildRequires:  {{ py3('setuptools') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
Generic Key Manager interface for OpenStack.

%package -n python3-castellan
Summary:        Generic Key Manager interface for OpenStack
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('python-barbicanclient') }}
Requires:       {{ py3('cryptography') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.context') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('stevedore') }}

%description -n python3-castellan
Generic Key Manager interface for OpenStack.

This package includes the Python 3.x module.

%package -n python-castellan-doc
Summary:        Documentation for castellan
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-svg2pdfconverter') }}

%description -n python-castellan-doc
Castellan is a generic Key Manager interface for OpenStack.
This package contains the documentation

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}
# generate html docs
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
python3 -m stestr.cli run

%files -n python3-castellan
%license LICENSE
%{python3_sitelib}/castellan
%{python3_sitelib}/*.egg-info

%files -n python-castellan-doc
%license LICENSE
%doc README.rst doc/build/html

%changelog
